onbind Event |
This event points to a function that will be executed each time when the tuple is bound to the HTML element.
Syntax
Inline HTML |
<ELEMENT id=elementID xql=XSLTPath onbind="handler"...></ELEMENT> |
Event property |
elementID.onbind = handler |
Parameters
Parameter |
Description |
---|---|
html |
Read-only. Object that denotes the actual HTML element to which the data is bound. |
busObject |
Read-only. Object that denotes the appropriate business element inside the tuple. (XML Inside tuple/new or tuple/old). |
tuple |
Read-only. Object that denotes the actual tuple that will be bound to the HTML element. |
Remarks
The onbind attribute can be defined on any HTML object inside the template which specifies the XQL attribute. Value of this attribute should be a valid function name as shown in the above example.
The function specified will be evaluated after the object on which it is defined is cloned and before it gets appended. Developers can use this to change the values or properties of the object cloned.
Example
This sample code shows how the event is used.
<!-- HTML definition for main table data (diEmployees - ID of the data island) --> <div class="buscontrol"> <div BusDataIsland="diEmployees" xql="."> <!-- HTML Content --> . . . <!-- One of the HTML content where data is to be displayed --> <label xql="gender/textnode()" onbind="setGender"></label> </div> </div> //Function called on onbind event of the buscontrol. function setGender(html, busObject, tuple) { //Get the data node var nodeValue = busObject.selectSingleNode("gender").text; //Set data in the HTML element based on value from the XML Node html.innerText = (nodeValue == "M") ? "Male" : "Female"; }